<template>
    <div class="audit_marks">
        <!--OC码-->
        <el-table class="loan_history_table" max-height="320" :data="tableData" style="width: 100%">
            <el-table-column align="left" prop="orderId" width="200" :label="$t('common.innerOrderId')"></el-table-column><!--内部订单号-->
            <el-table-column align="left" prop="ocCodeContent" :label="$t('audit.OCCode')"></el-table-column><!--OC码-->
            <el-table-column align="left" :label="$t('common.operatingTime')" prop="addTime"><!--操作时间-->
                <template slot-scope="scope">{{ scope.row.updateTime | formatDate('yyyy-MM-dd hh:mm:ss') }}</template>
            </el-table-column>
            <el-table-column align="left" prop="auditorName" :label="$t('audit.firstReviewer')"></el-table-column><!--初审员-->
        </el-table><!--end table-->
        <pagination @pageChange="pageChange" :page="page">分页组件</pagination>
    </div>
</template>

<script>
    import Pagination from '@/components/pagination';
    import mixin from '@/service/mixin';

    export default {
        name: 'OcCode',
        components: {
            Pagination
        },
        mixins: [mixin],
        props: {
            updateType: {
                type: String
            }
        },
        data() {
            return {
                userId: ''
            };
        },
        watch: {
            updateType(val) {
                if (val === 'OcCode') {
                    this.page.currentPage = 1;
                    this.getTableData();
                }
            }
        },
        methods: {
//        获取OC码
            getTableData(page = this.page) {
                const params = {
                    userId: this.userId,
                    page: {
                        pageNo: page.currentPage,
                        pageSize: this.page.pageSize
                    }
                };
                this.$api.audit.getOcCodeBean(params).then((res) => {
                    const {status, data} = res;
                    if ('1' === status) {
                        this.tableData = data.data;
                        // this.setPage(data.page, this.page);
                        this.page.recordsTotal = data.pageCount || 0;
                        if (this.updateType === 'OcCode') {
                            this.$emit('updateOver');
                        }
                    }
                });
            }
        },
        created() {
            if (this.$route.params.id) {
                this.userId = this.$route.params.id;
                this.getTableData({currentPage: this.page.currentPage});
            }
        }
    };
</script>

<style scoped>

</style>
